Many computer graphic images are created by mathematically modeling the interaction of light with a three dimensional scene from a given viewpoint. This process, called “rendering,” generates a two-dimensional image of the scene from the given viewpoint, and is analogous to taking a photograph of a real-world scene.
As the demand for computer graphics, and in particular for real-time computer graphics, has increased, computer systems with graphics processing subsystems adapted to accelerate the rendering process have become widespread. In these computer systems, the rendering process is divided between a computer's general purpose central processing unit (CPU) and the graphics processing subsystem, architecturally centered about a graphics processing unit (GPU). Typically, the CPU performs high-level operations, such as determining the position, motion, and collision of objects in a given scene. From these high level operations, the CPU generates a set of rendering commands and data defining the desired rendered image or images. For example, rendering commands and data can define scene geometry, lighting, shading, texturing, motion, and/or camera parameters for a scene. The graphics processing subsystem creates one or more rendered images from the set of rendering commands and data.
Scene geometry is typically represented by geometric primitives, such as points, lines, polygons (for example, triangles and quadrilaterals), and curved surfaces, defined by one or more two- or three-dimensional vertices. Each vertex may have additional scalar or vector attributes used to determine qualities such as the color, transparency, lighting, shading, and animation of the vertex and its associated geometric primitives.
Many graphics processing subsystems are highly programmable through an application programming interface (API), enabling complicated lighting and shading algorithms, among other things, to be implemented. To exploit this programmability, applications can include one or more graphics processing subsystem programs, which are executed by the graphics processing subsystem in parallel with a main program executed by the CPU. Although not confined merely to implementing shading and lighting algorithms, these graphics processing subsystem programs are often referred to as “shading programs,” “programmable shaders,” or simply “shaders.”
A variety of shading programs are directed at modeling illumination in a scene. The physical plausibility of rendered illumination often depends on the application, more specifically, whether or not the rendering is done in real-time. Physically plausible illumination at real-time frame rates is often achieved using approximations. For example, ambient occlusion is a popular approximation because of its high speed and simple implementation. Another example is directional occlusion. Many algorithms can only approximate direct illumination, which is light coming directly from a light source.
Global illumination is a concept that accounts for both direct illumination and indirect illumination, which is light that reflects off other surfaces, in rendering the scene. In doing so, a significantly more realistic image is achievable. However, real-time global illumination remains problematic for large and dynamic scenes. Efforts to mitigate the latency introduced by these comprehensive illumination algorithms are ongoing. For example, some algorithms partially pre-compute illumination. Another example is instant radiosity, which models indirect lighting as a set of point lights, the contributions of which are accumulated over multiple rendering passes. Yet another approach is to limit indirect lighting to a single bounce, under the assumption that one-bounce indirect illumination is sufficiently realistic. Still, real-time frame rates are typically only achievable through approximations.